package com.open.basic.exception;

import java.io.Serializable;

/**
 * @author: system
 * @Date: 2024/4/19 15:01
 * @Version: V1.0
 * @description: desc:通用异常类，基类
 */
public class GenericException extends RuntimeException implements Serializable {

    /**
     * 错误码
     */
    String code = null;

    /**
     * 异常信息
     */
    String msg = null;


    /**
     * 构造器.<br>
     *
     * @param message 异常信息
     */
    public GenericException(String message) {
        super(message);
    }

    /**
     * 构造器.<br>
     *
     * @param exception 异常对象
     */
    public GenericException(Exception exception) {
        super(exception);
    }

    public GenericException(Throwable throwable) {
        super(throwable);
    }

    /**
     * 构造器.<br>
     *
     * @param message   异常信息
     * @param exception 异常
     */
    public GenericException(String message, Exception exception) {
        super(message, exception);
    }

    public GenericException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public GenericException(String code, String message, Throwable throwable) {
        super(code + ":" + message, throwable);
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}

